%*******************************************************************************
%*
%*   Copyright ©2009 Alexandru Marin
%*
%*   This file is part of nwave/pMRI C library.
%*
%*   This project started as an MSc degree project during a
%*   stage at the Paris-Est university, under joint supervision of prof.
%*   Bogdan Ionescu (Image Analysis and Processing Laboratory, "Politehica"
%*   University of Bucharest), Caroline Chaux and Jean-Christophe Pesquet
%*   (Laboratoire d'Informatique, Université Paris-Est, Institut Gaspard Monge).
%*
%*   nwave/pMRI C libray is free software: you can redistribute it and/or modify
%*   it under the terms of the GNU General Public License as published by
%*   the Free Software Foundation, either version 2 of the License, or
%*   (at your option) any later version.
%*
%*   nwave/pMRI C libray is distributed in the hope that it will be useful,
%*   but WITHOUT ANY WARRANTY; without even the implied warranty of
%*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%*   GNU General Public License for more details.
%*
%*   You should have received a copy of the GNU General Public License
%*   along with nwave/pMRI C library. If not, see <http://www.gnu.org/licenses/>
%*
%*******************************************************************************


% Creates the following files needed by the ND DWT C implementation
%  db<N>_precond.csv
%  db<N>_postcond.csv
%  db<N>_hipassleft.csv
%  db<N>_lopassleft.csv
%  db<N>_hipassright.csv
%  db<N>_lopassright.csv
% 
% each containing the corresponding matrix.

function dwt_write_cdjv(N)

[HPF,LHPEF,RHPEF] = MakeCDJVFilter('HighPass',N);
[LPF,LLPEF,RLPEF] = MakeCDJVFilter('LowPass',N);
[LPREMAT,RPREMAT] = MakeCDJVFilter('PreCondition',N);
[LPOSTMAT,RPOSTMAT] = MakeCDJVFilter('PostCondition',N);

filters = [LPF;HPF;reverse(LPF);reverse(HPF)];

mri_write_matrix(['db' num2str(N) '.csv'],filters);
mri_write_matrix(['db' num2str(N) '_leftprecond.csv'],LPREMAT);
mri_write_matrix(['db' num2str(N) '_rightprecond.csv'],fliplr(flipud(RPREMAT)));
mri_write_matrix(['db' num2str(N) '_leftpostcond.csv'],LPOSTMAT);
mri_write_matrix(['db' num2str(N) '_rightpostcond.csv'],fliplr(flipud(RPOSTMAT)));
mri_write_matrix(['db' num2str(N) '_lefthipass.csv'],LHPEF);
mri_write_matrix(['db' num2str(N) '_righthipass.csv'],fliplr(flipud(RHPEF)));
mri_write_matrix(['db' num2str(N) '_leftlopass.csv'],LLPEF);
mri_write_matrix(['db' num2str(N) '_rightlopass.csv'],fliplr(flipud(RLPEF)));





